//
//  NovelDetailsHeaderView.m
//  A_Program
//
//  Created by dlios on 15-5-22.
//  Copyright (c) 2015年 BayMax. All rights reserved.
//

#import "NovelDetailsHeaderView.h"
@interface NovelDetailsHeaderView ()
@end

@implementation NovelDetailsHeaderView

- (void)dealloc
{
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSegmentedControl];
       
    }
    return self;
}
- (void)createSegmentedControl{
    NSMutableArray *array = [NSMutableArray array];
    [array addObject:@"最火"];
    [array addObject:@"最近更新"];
    [array addObject:@"经典"];
    [self setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:0.9]];
    
    self.detailsSegment = [[[UISegmentedControl alloc]initWithItems:array]autorelease];
    [self.detailsSegment setBackgroundColor:[UIColor whiteColor]];
    self.detailsSegment.frame = CGRectMake(10, 10, [UIScreen mainScreen].bounds.size.width - 20,[UIScreen mainScreen].bounds.size.height*0.05);
    //添加子视图
    [self addSubview:self.detailsSegment];
    self.detailsSegment.tintColor = [UIColor orangeColor];
    self.detailsSegment.selectedSegmentIndex = 0;
    [self.detailsSegment addTarget:self action:@selector(NovelDetailsAction:) forControlEvents:UIControlEventValueChanged];
}
- (void)NovelDetailsAction:(id)sender{
    [self.detailDelegate createSegment:sender];
}





@end
